"""
系统信息模型
"""
from sqlalchemy import Column, String, Text, Boolean, Integer
from .base import BaseModel


class SystemInfo(BaseModel):
    """系统信息模型"""
    __tablename__ = "system_info"
    
    user_session_id = Column(String(100), nullable=False, index=True)
    os_type = Column(String(50), nullable=True)  # Windows, Linux, macOS
    os_version = Column(String(100), nullable=True)
    architecture = Column(String(50), nullable=True)  # x64, x86, arm64
    hostname = Column(String(100), nullable=True)
    user_privileges = Column(String(50), nullable=True)  # admin, user, root
    installed_software = Column(Text, nullable=True)  # JSON格式的已安装软件列表
    environment_variables = Column(Text, nullable=True)  # JSON格式的环境变量
    network_info = Column(Text, nullable=True)  # JSON格式的网络信息
    is_virtual_machine = Column(Boolean, default=False)
    additional_info = Column(Text, nullable=True)  # JSON格式的其他信息
    
    def __repr__(self):
        return f"<SystemInfo(os='{self.os_type} {self.os_version}', hostname='{self.hostname}')>"
